function setGadgetsDimensions(){

	jQuery.each(jQuery('.dashboard .left-gadget'), function(index, value) {
		var top = 44.4833, gadgetIndex = 0;
		for(gadgetIndex = 0;gadgetIndex < index; gadgetIndex = gadgetIndex+1){
			var elem = jQuery('.dashboard .left-gadget').eq(gadgetIndex).children('.gadget-container');
			if(elem.find('.FlotPanel') != null){
				elem.children('.dashboard-item-content').height(elem.find('.FlotPanel').height());
				elem = elem.find('.FlotPanel');
				top = top + elem.height() + 40.3997;
			}else
				top = top + elem.height() + 16.3997;
		}
		var tmp = $(this).children('.gadget-container').height();
		if($(this).find('.FlotPanel') != null)
			tmp = $(this).find('.FlotPanel').height();
		var height = tmp + 24;
		$(this).height(height);
		$(this).css('top', top);
	});
	
	jQuery.each(jQuery('.dashboard .center-gadget'), function(index, value) {
		var top = 44.4833, gadgetIndex = 0;
		for(gadgetIndex = 0;gadgetIndex < index; gadgetIndex = gadgetIndex+1){
			var elem = jQuery('.dashboard .center-gadget').eq(gadgetIndex).children('.gadget-container');
			if(elem.find('.FlotPanel') != null){
				elem.children('.dashboard-item-content').height(elem.find('.FlotPanel').height());
				elem = elem.find('.FlotPanel');
				top = top + elem.height() + 40.3997;
			}else
				top = top + elem.height() + 16.3997;
		}
		var tmp = $(this).children('.gadget-container').height();
		if($(this).find('.FlotPanel') != null)
			tmp = $(this).find('.FlotPanel').height();
		var height = tmp + 24;
		$(this).height(height);
		$(this).css('top', top);
	});
	
	jQuery.each(jQuery('.dashboard .right-gadget'), function(index, value) {
		var top = 44.4833, gadgetIndex = 0;
		for(gadgetIndex = 0;gadgetIndex < index; gadgetIndex = gadgetIndex+1){
			var elem = jQuery('.dashboard .right-gadget').eq(gadgetIndex).children('.gadget-container');
			if(elem.find('.FlotPanel') != null){
				elem.children('.dashboard-item-content').height(elem.find('.FlotPanel').height());
				elem = elem.find('.FlotPanel');
				top = top + elem.height() + 40.3997;
			}else
				top = top + elem.height() + 16.3997;
		}
		var tmp = $(this).children('.gadget-container').height();
		if($(this).find('.FlotPanel') != null)
			tmp = $(this).find('.FlotPanel').height();
		var height = tmp + 24;
		$(this).height(height);
		$(this).css('top', top);
	});
	
}

$(document).ready(function() {
	setGadgetsDimensions();
	
	$(window).resize(function() {
		setGadgetsDimensions();
	});
});